import request from '@/utils/request'

function dictList (param) {
  let data;
  if (param) {
    data = {parentId: param};
  }
  return request({
    url: '/dict/list',
    method: 'get',
    params: data
  });
}

function addDict (data) {
  return request({
    url: '/dict/add',
    method: 'post',
    data
  });
}

function editDict (data) {
  return request({
    url: '/dict/update',
    method: 'post',
    data
  });
}

function delDict (id) {
  return request({
    url: '/dict/delete',
    method: 'get',
    params: {
      id: id
    }
  });
}

function getById (id) {
  return request({
    url: '/dict/detail',
    method: 'get',
    params: {
      id: id
    }
  });
}

export {
  dictList,
  addDict,
  editDict,
  delDict,
  getById
}
